package com.pipe.protocol.query;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;

/**
 * @author Kiven
 */
public class ComQueryPackage {
    private byte command = 0x03;
    private String queryInfo;

    public ComQueryPackage(String queryInfo) {
        this.queryInfo = queryInfo;
    }

    public ByteBuf toBytebuf() {
        byte[] queryInfoArr = queryInfo.getBytes();
        ByteBuf byteBuf = Unpooled.directBuffer( 1 + queryInfoArr.length);
        byteBuf.writeByte(command);
        byteBuf.writeBytes(queryInfoArr);
        return byteBuf;

    }
}